function Avar=ERRORS(param)    

%   GLOBAL

global Y T1 T2 SM SR Draws M Xc Gmax Gmin ll
%%

N=length(Y);
N_p=size(param,1);    

S_A=zeros(N,N_p);
li_PER=zeros(N,2);
for p=1:N_p


eps3=eps*10000000000 ;
h=(eps3)*(max(abs(param(p,1)),1000));
h=h/5;
for g=1:2
        
param_P=param;    
    
    
if g==1    
    param_P(p,1)=param(p,1)+h     ;
elseif g==2
    param_P(p,1)=param(p,1)-h     ;
end


    
LogLikelihood_years(param_P);
li_PER(:,g) = ll   ;


end    
    
S_A(:,p) = times((li_PER(:,1)-li_PER(:,2)),(1/(2*h)))  ;
%%
  
end    
size(S_A) 

AA=zeros(N_p,N_p); 
S_A_t=transpose(S_A);


for j=1:N
 Aj=S_A_t(:,j)*S_A(j,:);
 AA=AA+Aj;
end


Avar=inv(AA);

st_errors=zeros(N_p,1);
for p=1:N_p

    st_errors(p,1)=sqrt(Avar(p,p));

end

p_values=zeros(N_p,1);
for p=1:N_p
p_values(p,1)=(2*(1-cdf('Normal',((abs(param(p,1)))/st_errors(p,1)),0,1)));
end

p10=(p_values>0.1);
p5=(p_values>0.05);
p1=(p_values>0.01);

st_err=[st_errors p_values p10 p5 p1];

end

